import requests
import execjs
from datetime import datetime, timezone, timedelta
import pandas as pd
import os
import time
import random
import re
import json
cookies = {
    'acw_tc': '1a0c399e17500522750161365e005a6c0f7f47ba44cb2b4029fc34bded1df6',
    'QCCSESSID': 'a65de1aca046ddbeb4c7077a3a',
    'qcc_did': 'a484e201-31c3-4dbc-9ebe-f09259449431',
    'UM_distinctid': '197773e86b3b06-03e4f96b4913088-26011e51-144000-197773e86b41ce9',
    'tfstk': 'gL7IBw_DEvDB1T8-NHVZ52StrFT7O5zqFbORi_3EweLKeYCvQB7UK_p5FOJiLMrlUTM5LOWWqWvyeL6PwMPaur5htUYRF-z4ugnWBOXIeUKLwCdDZ5RLe52ZLUY83R-CkiVMr9pHDSWR65Oya2dRe3pO6dAI2Upp2An9MdLJy338WCdvG4HKyUF16dAJyLBJy5T9IQHT5ROgApCQTS4IJIV7Q19sy4Q668vROcuvtZABAKCdR438MBtBH6p_pxDKXhCkVacoP35dmTAApveWEN1OJiBYQDJdcQ1VVtFrxC-5-F9RJrcXBw155HjZpDdXRptAJnU7GsKRfNTFJ8mc_19pcFSajJ-yR9sDnHEgIT16LTQBXvwwUi5NJh6YQV6kVgQeWweTlgoEuKNg60G6m4O635Nsq02Q5ZQtIMuCkHdM_ZP_1vikvCAsNaPsY0KpsC-T15MIc',
    'CNZZDATA1254842228': '1966791317-1750052276-https%253A%252F%252Fwww.qcc.com%252F%7C1750052369',
}
with open('./get_header.js', 'r', encoding='utf-8') as f:
    js_code = f.read()
ctx = execjs.compile(js_code)

# 获取软件著作权字段信息


def get_rjzzquandata(data, data_code):
    items = []
    for i in range(10):
        try:
            rjzzqlist = []
            Owner = data['data'][i]['Owner']
            Name = data['data'][i]['Name']
            ShortName = data['data'][i]['ShortName']
            VersionNo = data['data'][i]['VersionNo']
            RegisterNo = data['data'][i]['RegisterNo']
            try:
                DevelopDate = datetime.fromtimestamp(
                    int(data['data'][i]['DevelopDate']), tz=timezone.utc)
                adjusted_date = DevelopDate + timedelta(hours=8)
                formatted_time = adjusted_date.strftime("%Y-%m-%d ")
                DevelopDate = formatted_time
            except:
                DevelopDate = '-'
            try:
                PublishDate = datetime.fromtimestamp(
                    int(data['data'][i]['PublishDate']), tz=timezone.utc)
                adjusted_date = PublishDate + timedelta(hours=8)
                formatted_time = adjusted_date.strftime("%Y-%m-%d ")
                PublishDate = formatted_time
            except:
                PublishDate = '-'
            try:
                RegisterAperDate = datetime.fromtimestamp(
                    int(data['data'][i]['RegisterAperDate']), tz=timezone.utc)
                adjusted_date = RegisterAperDate + timedelta(hours=8)
                formatted_time = adjusted_date.strftime("%Y-%m-%d ")
                RegisterAperDate = formatted_time
            except:
                RegisterAperDate = '-'
            Acquireway = data['data'][i]['Acquireway']
            rjzzqlist.extend(
                [Owner, Name, ShortName, VersionNo, RegisterNo, DevelopDate, PublishDate, RegisterAperDate, Acquireway, data_code])
            items.append(rjzzqlist)
        except:
            return items
    return items

# 软件著作权信息追加


def write_csv_rjzzq(items):
    """软件著作权信息追加"""
    file_exists = os.path.exists('./ruanjian.csv')
    df = pd.DataFrame(items, columns=['公司名称', '软件全称', '软件简称', '版本号', '登记号', '开发完成日期',
                                      '首次发布日期', '等级日期', '权力取得方式', '统一社会信用代码'])
    df.to_csv('ruanjian.csv', mode='a',
              index=False, header=not file_exists)
    if not file_exists:
        print("创建新文件并写入表头和数据")
    else:
        print("软件著作权数据已追加到 ruanjian.csv")

# 获取专利字段信息


def get_zhuanlidata(data, data_code):
    items = []
    for i in range(10):
        try:
            zhuanlilist = []
            AssigneeList = data['data'][i]['AssigneeList']
            titofint = data['data'][i]['Title']
            KindCodeDesc = data['data'][i]['KindCodeDesc']
            LegalStatusDesc = data['data'][i]['LegalStatusDesc']
            ApplicationNumber = data['data'][i]['ApplicationNumber']
            Application_date = datetime.fromtimestamp(
                int(data['data'][i]['ApplicationDate']), tz=timezone.utc)
            adjusted_date = Application_date + timedelta(hours=8)
            formatted_time = adjusted_date.strftime("%Y-%m-%d ")
            Application_date = formatted_time
            PublicationNumber = data['data'][i]['PublicationNumber']
            LegalStatusDate = datetime.fromtimestamp(
                int(data['data'][i]['LegalStatusDate']), tz=timezone.utc)
            adjusted_date = LegalStatusDate + timedelta(hours=8)
            formatted_time = adjusted_date.strftime("%Y-%m-%d ")
            LegalStatusDate = formatted_time
            inventor = data['data'][i]['InventorList']
            zhuanlilist.extend([AssigneeList, titofint, KindCodeDesc, LegalStatusDesc, ApplicationNumber,
                                Application_date, PublicationNumber, LegalStatusDate, inventor, data_code])
            items.append(zhuanlilist)
        except:
            return items
    return items

# 专利信息追加写入elex文件中


def write_csv_zhuanli(items):
    """专利信息追加写入csv文件中"""
    file_exists = os.path.exists('./zhuanli.csv')
    df = pd.DataFrame(items, columns=['公司名称', '发明名称', '专利类型', '法律状态', '申请号', '申请日期',
                                      '公开号', '公开日期', '发明人', '统一社会信用代码'])
    df.to_csv('zhuanli.csv', mode='a',
              index=False, header=not file_exists)
    if not file_exists:
        print("创建新文件并写入表头和数据")
    else:
        print("专利信息数据已追加到 zhuanli.csv")


def start_zhunali_22(keyno, s_code):
    # 专利信息的获取
    for i in range(1, 201):
        e = "/api/datalist/zhuanlilist"
        h = 'e013192b52986624012ced093116f206'
        json_data = {
            'keyNo': keyno,
            'pageIndex': i,
            'isNewAgg': True,
            'status': 'ZT002001',
            'applicationYear': '2022',
        }
        header1 = ctx.call('get_i', e, json_data)
        header2 = ctx.call('get_u', e, json_data, h)
        headers = {
            header1: header2,
            'accept': 'application/json, text/plain, */*',
            'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
            'content-type': 'application/json',
            'origin': 'https://www.qcc.com',
            'priority': 'u=1, i',
            'sec-ch-ua': '"Google Chrome";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
            'sec-ch-ua-mobile': '?0',
            'sec-ch-ua-platform': '"Windows"',
            'sec-fetch-dest': 'empty',
            'sec-fetch-mode': 'cors',
            'sec-fetch-site': 'same-origin',
            'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
            'x-pid': '866e1280b4211ca8dfd7c80b28f9958e',
            'x-requested-with': 'XMLHttpRequest',
        }
        try:
            response = requests.post('https://www.qcc.com/api/datalist/zhuanlilist',
                                     cookies=cookies, headers=headers, json=json_data)
            if response.status_code != 200:
                print(f"22年————{keyno}下的第{i}页专利信息获取失败!!!!!")
                break
            time.sleep(random.uniform(5, 10))
        except:
            break
        if response.text != 'null':
            pass
        else:
            break
        data = response.json()
        if data['data'] == []:
            print(f'2022年的第{i}页没有专利信息')
            break
        data_code = s_code
        zhuanli_data = get_zhuanlidata(data, data_code)
        write_csv_zhuanli(zhuanli_data)


def start_zhunali_23(keyno, s_code):
    # 专利信息的获取
    for i in range(1, 501):
        e = "/api/datalist/zhuanlilist"
        h = 'e013192b52986624012ced093116f206'
        json_data = {
            'keyNo': keyno,
            'pageIndex': i,
            'isNewAgg': True,
            'status': 'ZT002001',
            'applicationYear': '2023',
        }
        header1 = ctx.call('get_i', e, json_data)
        header2 = ctx.call('get_u', e, json_data, h)
        headers = {
            header1: header2,
            'accept': 'application/json, text/plain, */*',
            'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
            'content-type': 'application/json',
            'origin': 'https://www.qcc.com',
            'priority': 'u=1, i',
            'sec-ch-ua': '"Google Chrome";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
            'sec-ch-ua-mobile': '?0',
            'sec-ch-ua-platform': '"Windows"',
            'sec-fetch-dest': 'empty',
            'sec-fetch-mode': 'cors',
            'sec-fetch-site': 'same-origin',
            'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
            'x-pid': '866e1280b4211ca8dfd7c80b28f9958e',
            'x-requested-with': 'XMLHttpRequest',
        }
        try:
            response = requests.post('https://www.qcc.com/api/datalist/zhuanlilist',
                                     cookies=cookies, headers=headers, json=json_data)
            if response.status_code != 200:
                print(f"23年————————{keyno}下的第{i}页专利信息获取失败!!!!!")
                break
            time.sleep(random.uniform(5, 10))
        except:
            break
        if response.text != 'null':
            pass
        else:
            break
        data = response.json()
        if data['data'] == []:
            print(f'2023年的第{i}页没有专利信息')
            break
        data_code = s_code
        zhuanli_data = get_zhuanlidata(data, data_code)
        write_csv_zhuanli(zhuanli_data)


def start_zhunali_24(keyno, s_code):
    # 专利信息的获取
    for i in range(1, 501):
        e = "/api/datalist/zhuanlilist"
        h = 'e013192b52986624012ced093116f206'
        json_data = {
            'keyNo': keyno,
            'pageIndex': i,
            'isNewAgg': True,
            'status': 'ZT002001',
            'applicationYear': '2024',
        }
        header1 = ctx.call('get_i', e, json_data)
        header2 = ctx.call('get_u', e, json_data, h)
        headers = {
            header1: header2,
            'accept': 'application/json, text/plain, */*',
            'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
            'content-type': 'application/json',
            'origin': 'https://www.qcc.com',
            'priority': 'u=1, i',
            'sec-ch-ua': '"Google Chrome";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
            'sec-ch-ua-mobile': '?0',
            'sec-ch-ua-platform': '"Windows"',
            'sec-fetch-dest': 'empty',
            'sec-fetch-mode': 'cors',
            'sec-fetch-site': 'same-origin',
            'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
            'x-pid': '866e1280b4211ca8dfd7c80b28f9958e',
            'x-requested-with': 'XMLHttpRequest',
        }
        try:
            response = requests.post('https://www.qcc.com/api/datalist/zhuanlilist',
                                     cookies=cookies, headers=headers, json=json_data)
            if response.status_code != 200:
                print(f"24年————————{keyno}下的第{i}页专利信息获取失败!!!!!")
                break
            time.sleep(random.uniform(5, 10))
        except:
            break
        if response.text != 'null':
            pass
        else:
            break
        data = response.json()
        if data['data'] == []:
            print(f'2024年的第{i}页没有专利信息')
            break
        data_code = s_code
        zhuanli_data = get_zhuanlidata(data, data_code)
        write_csv_zhuanli(zhuanli_data)


def start_zhunali_25(keyno, s_code):
    # 专利信息的获取
    for i in range(1, 501):
        e = "/api/datalist/zhuanlilist"
        h = 'e013192b52986624012ced093116f206'
        json_data = {
            'keyNo': keyno,
            'pageIndex': i,
            'isNewAgg': True,
            'status': 'ZT002001',
            'applicationYear': '2025',
        }
        header1 = ctx.call('get_i', e, json_data)
        header2 = ctx.call('get_u', e, json_data, h)
        headers = {
            header1: header2,
            'accept': 'application/json, text/plain, */*',
            'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
            'content-type': 'application/json',
            'origin': 'https://www.qcc.com',
            'priority': 'u=1, i',
            'sec-ch-ua': '"Google Chrome";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
            'sec-ch-ua-mobile': '?0',
            'sec-ch-ua-platform': '"Windows"',
            'sec-fetch-dest': 'empty',
            'sec-fetch-mode': 'cors',
            'sec-fetch-site': 'same-origin',
            'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
            'x-pid': '866e1280b4211ca8dfd7c80b28f9958e',
            'x-requested-with': 'XMLHttpRequest',
        }
        try:
            response = requests.post('https://www.qcc.com/api/datalist/zhuanlilist',
                                     cookies=cookies, headers=headers, json=json_data)
            if response.status_code != 200:
                print(f"25年————————{keyno}下的第{i}页专利信息获取失败!!!!!")
                break
            time.sleep(random.uniform(5, 10))
        except:
            break
        if response.text != 'null':
            pass
        else:
            break
        data = response.json()
        if data['data'] == []:
            print(f'2025年的第{i}页没有专利信息')
            break
        data_code = s_code
        zhuanli_data = get_zhuanlidata(data, data_code)
        write_csv_zhuanli(zhuanli_data)


def start_rjzzq_22(keyno, s_code):
    # 软件著作权的获取
    for i in range(1, 501):
        e = "/api/datalist/rjzzqlist"
        h = '5288df35e8408a9eafe856da0d0994db'
        json_data = {
            'keyNo': keyno,
            'pageIndex': i,
            'isNewAgg': True,
            'regYear': '2022',
        }
        header1 = ctx.call('get_i', e, json_data)
        header2 = ctx.call('get_u', e, json_data, h)
        headers = {
            header1: header2,
            'accept': 'application/json, text/plain, */*',
            'accept-language': 'zh-CN,zh;q=0.9',
            'content-type': 'application/json',
            'origin': 'https://www.qcc.com',
            'priority': 'u=1, i',
            'referer': 'https://www.qcc.com/cassets/33a2bc3ecae30dd877df6aceec63424a.html',
            'sec-ch-ua': '"Google Chrome";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
            'sec-ch-ua-mobile': '?0',
            'sec-ch-ua-platform': '"Windows"',
            'sec-fetch-dest': 'empty',
            'sec-fetch-mode': 'cors',
            'sec-fetch-site': 'same-origin',
            'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
            'x-pid': '52b3394487f77426c656f87ed7d1b15c',
            'x-requested-with': 'XMLHttpRequest',
        }
        try:
            response = requests.post('https://www.qcc.com/api/datalist/rjzzqlist',
                                     cookies=cookies, headers=headers, json=json_data, timeout=20)
            if response.status_code != 200:
                print(f'22年————————{keyno}下的第{i}页软件著作权获取失败!!!!!')
            time.sleep(random.uniform(5, 10))
        except Exception as e:
            print(f"请求错误: {str(e)}")
            break

        if response.json()['data'] != []:
            pass
        else:
            print(f"22年的第{i}页没有软件著作权！")
            break

        data = response.json()
        if data['data'] == []:
            print(f"22年的第{i}页没有软件著作权！")
            break
        rjzzq_list = get_rjzzquandata(data, s_code)
        write_csv_rjzzq(rjzzq_list)


def start_rjzzq_23(keyno, s_code):
    # 软件著作权的获取
    for i in range(1, 501):
        e = "/api/datalist/rjzzqlist"
        h = '5288df35e8408a9eafe856da0d0994db'
        json_data = {
            'keyNo': keyno,
            'pageIndex': i,
            'isNewAgg': True,
            'regYear': '2023',
        }
        header1 = ctx.call('get_i', e, json_data)
        header2 = ctx.call('get_u', e, json_data, h)
        headers = {
            header1: header2,
            'accept': 'application/json, text/plain, */*',
            'accept-language': 'zh-CN,zh;q=0.9',
            'content-type': 'application/json',
            'origin': 'https://www.qcc.com',
            'priority': 'u=1, i',
            'referer': 'https://www.qcc.com/cassets/33a2bc3ecae30dd877df6aceec63424a.html',
            'sec-ch-ua': '"Google Chrome";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
            'sec-ch-ua-mobile': '?0',
            'sec-ch-ua-platform': '"Windows"',
            'sec-fetch-dest': 'empty',
            'sec-fetch-mode': 'cors',
            'sec-fetch-site': 'same-origin',
            'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
            'x-pid': '52b3394487f77426c656f87ed7d1b15c',
            'x-requested-with': 'XMLHttpRequest',
        }
        try:
            response = requests.post('https://www.qcc.com/api/datalist/rjzzqlist',
                                     cookies=cookies, headers=headers, json=json_data, timeout=20)
            if response.status_code != 200:
                print(f'23年————————{keyno}下的第{i}页软件著作权获取失败!!!!!')
                # break
            time.sleep(random.uniform(5, 10))
        except Exception as e:
            print(f"请求错误: {str(e)}")
            break

        if response.json()['data'] != []:
            pass
        else:
            print(f"23年的第{i}页没有软件著作权！")
            break

        data = response.json()
        if data['data'] == []:
            print(f"23年的第{i}页没有软件著作权！")
            break
        rjzzq_list = get_rjzzquandata(data, s_code)
        write_csv_rjzzq(rjzzq_list)


def start_rjzzq_24(keyno, s_code):
    # 软件著作权的获取
    for i in range(1, 501):
        e = "/api/datalist/rjzzqlist"
        h = '5288df35e8408a9eafe856da0d0994db'
        json_data = {
            'keyNo': keyno,
            'pageIndex': i,
            'isNewAgg': True,
            'regYear': '2024',
        }
        header1 = ctx.call('get_i', e, json_data)
        header2 = ctx.call('get_u', e, json_data, h)
        headers = {
            header1: header2,
            'accept': 'application/json, text/plain, */*',
            'accept-language': 'zh-CN,zh;q=0.9',
            'content-type': 'application/json',
            'origin': 'https://www.qcc.com',
            'priority': 'u=1, i',
            'referer': 'https://www.qcc.com/cassets/33a2bc3ecae30dd877df6aceec63424a.html',
            'sec-ch-ua': '"Google Chrome";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
            'sec-ch-ua-mobile': '?0',
            'sec-ch-ua-platform': '"Windows"',
            'sec-fetch-dest': 'empty',
            'sec-fetch-mode': 'cors',
            'sec-fetch-site': 'same-origin',
            'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
            'x-pid': '52b3394487f77426c656f87ed7d1b15c',
            'x-requested-with': 'XMLHttpRequest',
        }
        try:
            response = requests.post('https://www.qcc.com/api/datalist/rjzzqlist',
                                     cookies=cookies, headers=headers, json=json_data, timeout=20)
            if response.status_code != 200:
                print(f'24年————————{keyno}下的第{i}页软件著作权获取失败!!!!!')
                # break
            time.sleep(random.uniform(5, 10))
        except Exception as e:
            print(f"请求错误: {str(e)}")
            break

        if response.json()['data'] != []:
            pass
        else:
            print(f"24年的第{i}页没有软件著作权！")
            break

        data = response.json()
        if data['data'] == []:
            print(f"24年的第{i}页没有软件著作权！")
            break
        rjzzq_list = get_rjzzquandata(data, s_code)
        write_csv_rjzzq(rjzzq_list)


def start_rjzzq_25(keyno, s_code):
    # 软件著作权的获取
    for i in range(1, 501):
        e = "/api/datalist/rjzzqlist"
        h = '5288df35e8408a9eafe856da0d0994db'
        json_data = {
            'keyNo': keyno,
            'pageIndex': i,
            'isNewAgg': True,
            'regYear': '2025',
        }
        header1 = ctx.call('get_i', e, json_data)
        header2 = ctx.call('get_u', e, json_data, h)
        headers = {
            header1: header2,
            'accept': 'application/json, text/plain, */*',
            'accept-language': 'zh-CN,zh;q=0.9',
            'content-type': 'application/json',
            'origin': 'https://www.qcc.com',
            'priority': 'u=1, i',
            'referer': 'https://www.qcc.com/cassets/33a2bc3ecae30dd877df6aceec63424a.html',
            'sec-ch-ua': '"Google Chrome";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
            'sec-ch-ua-mobile': '?0',
            'sec-ch-ua-platform': '"Windows"',
            'sec-fetch-dest': 'empty',
            'sec-fetch-mode': 'cors',
            'sec-fetch-site': 'same-origin',
            'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
            'x-pid': '52b3394487f77426c656f87ed7d1b15c',
            'x-requested-with': 'XMLHttpRequest',
        }
        try:
            response = requests.post('https://www.qcc.com/api/datalist/rjzzqlist',
                                     cookies=cookies, headers=headers, json=json_data, timeout=20)
            if response.status_code != 200:
                print(f'25年————————{keyno}下的第{i}页软件著作权获取失败!!!!!')
                # break
            time.sleep(random.uniform(5, 10))
        except Exception as e:
            print(f"请求错误: {str(e)}")
            break

        if response.json()['data'] != []:
            pass
        else:
            print(f"25年的第{i}页没有软件著作权！")
            break

        data = response.json()
        if data['data'] == []:
            print(f"25年的第{i}页没有软件著作权！")
            break
        rjzzq_list = get_rjzzquandata(data, s_code)
        write_csv_rjzzq(rjzzq_list)


def process_company(keyno, s_code):
    """处理单个公司的数据获取"""
    # start_zhunali_22(keyno, s_code)
    # start_zhunali_23(keyno, s_code)
    # start_zhunali_24(keyno, s_code)
    # start_zhunali_25(keyno, s_code)
    # print(f'{keyno}专利信息写入完毕————————————')
    start_rjzzq_22(keyno, s_code)
    start_rjzzq_23(keyno, s_code)
    start_rjzzq_24(keyno, s_code)
    start_rjzzq_25(keyno, s_code)
    print(f'{keyno}软件著作权信息写入完毕————————————')


def main():
    """主函数"""
    # 这里需要提供公司keyno列表
    urls = []
    with open("./qichacha_url.txt", "r", encoding="utf-8") as file:
        urls = [url.strip() for url in file.readlines()]

    names = []
    with open('./qichacha_code.txt', 'r', encoding='utf-8') as f:
        names = [name.strip() for name in f.readlines()]

    # 顺序处理所有keyno
    for keyno, name in zip(urls, names):
        process_company(keyno,name)


if __name__ == '__main__':
    main()
